﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.hud.components {
    import flash.events.*;
    import Engine.Managers.*;
    import flash.display.*;
    import Display.*;

    public class HUDQuestManagerIconComponent extends HUDComponent {

        public function HUDQuestManagerIconComponent(){
            this.visible = false;
            this.loadAssets();
        }
        protected function loadAssets():void{
            LoadingManager.load(Global.getAssetURL(Global.gameSettings.getString("questManagerIconUrl")), this.onIconLoaded);
        }
        protected function onIconLoaded(_arg1:Event):void{
            var _local2:Loader = (_arg1.target.loader as Loader);
            var _local3:Bitmap = (_local2.content as Bitmap);
            var _local4:GameSprite = new GameSprite();
            _local4.addChild(_local3);
            _local4.toolTip = ZLoc.t("Quest", "quest_manager_icon_tooltip");
            _local4.buttonMode = true;
            _local4.useHandCursor = true;
            _local4.addEventListener(MouseEvent.CLICK, this.onQuestManagerClick);
            _local4.hideCursor = true;
            this.addChild(_local4);
            if (UI.questManagerView.content.model.size() > 0){
                this.visible = true;
            };
        }
        protected function onQuestManagerClick(_arg1:MouseEvent):void{
            UI.displayQuestManager();
            Global.ui.resetActionMenu();
            StatsManager.count("quest_manager", "open");
        }

    }
}//package Display.hud.components 
